<template>
  <div class="box">
    <h1>A组件,{{ count }}</h1>
    <el-button type="primary" @click="handlePlus">数字+</el-button>
    <div v-for="item in goods">名称：{{ item.name }} 价格:{{ item.price }}</div>
  </div>
</template>

<script>
export default {
  computed: {
    count() {
      return this.$store.state.count.num;
    },
    goods() {
      return this.$store.state.good.goods;
    },
  },
  methods: {
    handlePlus() {
      this.$store.commit("count/increment");
    },
  },
};
</script>

<style lang="scss" scoped>
.box {
  width: 50%;
  border: 1px solid #333;
  height: 500px;
}
</style>
